package cn.tellfish.studydemo.thread;

import org.junit.Test;

public class ThreadTest2 {

    @Test
    public void test() {
//        new Actor().start();
        Thread act = new Thread(new Acctress());
        act.setName("hahahahahhha");
        act.start();

        try {
            act.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }

}

class Acctress implements Runnable {

    volatile boolean keepRunning = true;

    @Override
    public void run() {
        while (keepRunning) {
            System.out.println("asdfasdf");
            System.out.println(Thread.currentThread().getName());
        }

    }
}

class Actor extends Thread {

    @Override
    public void run() {
        System.out.println("asdfasdf");
    }

}
